<template>
  <div>
    <el-dialog title="修改角色名字" :visible.sync="dialogVisible" width="400px">
      <el-form class="demo-form-inline" label-width="80px">
        <el-form-item label="修改名字">
          <el-input v-model="data.roleName" />
        </el-form-item>
      </el-form>

      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="submit()">提 交</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import apiRole from "@/api/baseManager/role";
export default {
  name: "dialogRoleEdit",
  data() {
    return {
      dialogVisible: false,
      data: {
        roleId: "",
        roleName: ""
      }
    };
  },
  methods: {
    open(row) {
      this.data = {};
      this.dialogVisible = true;
      apiRole.getByRoleId(row.roleId).then(res=>{
        this.data = res.data.itouchSysRoles
      })
    },
    //提交
    submit() {
      apiRole.saveOrUpdate(this.data).then(res => {
        this.$parent.getList(); //调父组件方法 刷新表格
        this.dialogVisible = false;
      });
    }
  }
};
</script>

<style scoped>
</style>